package com.repository.dao;

import java.util.List;

import com.repository.model.User;

/**
 * Data Access Object interface to perform CRUD operations
 * on persistant store w.r.t. {@link User}
 * @author lovkeshsingh
 *
 */
public interface UserDAO {
	
	/**
	 * Field Names
	 */
	public static final String USERID = "id";
	public static final String USERNAME = "userName";
	public static final String PASSWORD = "password";

	/**
	 * Returns {@link User} from persistant store
	 * @param userId
	 * @return
	 */
	public abstract User getUser(Long userId);

	/**
	 * Returns {@link List} of all {@link User}s in system
	 * @return
	 */
	public abstract List<User> getUsers();

	/**
	 * Removes a {@link User} from persistant store
	 * @param user
	 */
	public abstract void removeUser(User user);

	/**
	 * Adds new {@link User} to the persistant store or updates it, if it already
	 * exists
	 * @param user
	 * @return
	 */
	public abstract User saveOrUpdateUser(User user);

	/**
	 * Finds {@link User} on the basis of one of its attributes
	 * @param propertyName
	 * @param value could only be userName for now
	 * @return {@link User}
	 */
	public abstract List findByProperty(String propertyName, Object value);

	public abstract List<User> findByUserIdList(List<String> userIdList);

}